From: Stephen Berman Date: Wed, 13 Oct 2010 23:15:03 +0000 (+0200) Subject: lisp/subr.el (last): Use `safe-length' instead of `length' (bug#7206). X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1~1^2~324^2~6092 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=113f7d427837ff87c4b39ea52509f764e243e7d7;p=emacs.git lisp/subr.el (last): Use `safe-length' instead of `length' (bug#7206). --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cea50f8625e..bed00b43055 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2010-10-13 Stephen Berman + + * subr.el (last): Use `safe-length' instead of `length' (bug#7206). + 2010-10-13 Lars Magne Ingebrigtsen * net/tls.el (tls-program): Remove spurious %s from openssl. diff --git a/lisp/subr.el b/lisp/subr.el index 0ed4ae62795..dabadec770e 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -290,10 +290,10 @@ If N is non-nil, return the Nth-to-last link of LIST. If N is bigger than the length of LIST, return LIST." (if n (and (> n 0) - (let ((m (length list))) + (let ((m (safe-length list))) (if (< n m) (nthcdr (- m n) list) list))) (and list - (nthcdr (1- (length list)) list)))) + (nthcdr (1- (safe-length list)) list)))) (defun butlast (list &optional n) "Return a copy of LIST with the last N elements removed."